#ifndef __tenacitas_interlace_text_core_layouts_tester_h__
#define __tenacitas_interlace_text_core_layouts_tester_h__

#include <iostream>
#include <cstdint>
#include <string>

#include "runtest.h"

#include <tenacitas.interlace_text.core/layouts.h>

namespace tenacitas {
    namespace interlace_text {
        namespace core {



            class layouts_tester {
            private:
                
                struct supplier {
                    struct interlace {};    
                    typedef std::string text;
                };

                typedef core::layouts<supplier> layouts;
                typedef core::layouts<supplier> layout;
                typedef supplier::text text;
                
                static bool test1() {
                    std::cerr << "\n+++ layouts_tester::test1" << std::endl;

                    text _text("abacaxi");
                    
                    layouts _layouts;

                    _layouts.add(_text);

                    _layouts.print(std::cerr);

                    return (_layouts.get_size() == 1);
                }

                static bool test2() {
                    std::cerr << "\n+++ layouts_tester::test2" << std::endl;

                    text _text("abacaxi");
                    
                    layouts _layouts;

                    _layouts.add(_text);

                    _layouts.add(_text);

                    return (_layouts.get_size() == 1);
                }

                static bool test3() {
                    std::cerr << "\n+++ layouts_tester::test3" << std::endl;

                    text _text("abacaxi");
                    
                    layouts _layouts;

                    _layouts.add(_text);

                    _layouts.add(_text);

                    _layouts.print(std::cerr);

                    return (!_layouts.is_positioned());
                }

                static bool test4() {
                    std::cerr << "\n+++ layouts_tester::test4" << std::endl;

                    text _w1("abacaxi");

                    text _w2("xixi");
                    
                    layouts _layouts;

                    _layouts.add(_w1);
                    _layouts.print(std::cerr);

                    _layouts.add(_w2);
                    _layouts.print(std::cerr);

                    _layouts.print(std::cerr);
                    return (_layouts.get_size() == 2);
                }


            public:
                static void run() {
                    runtest(layouts_tester::test1());
                    runtest(layouts_tester::test2());
                    runtest(layouts_tester::test3());
                    runtest(layouts_tester::test4());
                }
            };
        }
    }
}

#endif
